import axios from 'axios'

const instance = axios.create({
    baseURL: 'http://localhost:8888/',
    timeout: 1000,
    // headers: {'X-Custom-Header': 'foobar'}
  });


  // 添加响应拦截器
  instance.interceptors.response.use(
    response => {

		if (response.data.code == 1) {
			return response.data;
		}
	
		return Promise.reject(response)
	},
	err => {
		console.error(err); // 打印错误响应  


		return Promise.reject(err);
	});


  
export default instance;